//
//  BKSettingViewController.m
//  baokaodaxue
//
//  Created by dangyangyang on 15/5/26.
//  Copyright (c) 2015年 报考大学. All rights reserved.
//

#import "BKSettingViewController.h"
#import "BKFeedBackViewController.h"
#import <PgySDK/PgyManager.h>

#define DATA @[@"清除缓存",@"反馈建议",@"关于我们",@"版本更新"]
@interface BKSettingViewController ()<UITableViewDelegate,UITableViewDataSource>


@end

@implementation BKSettingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)p_back:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
#pragma mark tableView
- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *reuseIndentify = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIndentify];
    if (!cell) {
        [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:reuseIndentify];
        cell = [tableView dequeueReusableCellWithIdentifier:reuseIndentify];
        
    }
    tableView.separatorColor = [UIColor colorWithRed:0.196 green:0.600 blue:0.878 alpha:1.000];
    cell.selectedBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height)];
    cell.selectedBackgroundView .backgroundColor = [UIColor colorWithRed:0.455 green:0.702 blue:0.843 alpha:1.000];
    cell.textLabel.text = DATA[indexPath.row];
    cell.textLabel.font = [UIFont systemFontOfSize:14];
    cell.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"accessory"]];
    return cell;
    
}

- (NSInteger)tableView:(UITableView *)tableView
 numberOfRowsInSection:(NSInteger)section{
    
    return  [DATA count];
}

- (CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 40;
}

- (CGFloat)tableView:(UITableView *)tableView
heightForFooterInSection:(NSInteger)section{
    return 20;
}

- (UIView *)tableView:(UITableView *)tableView
viewForFooterInSection:(NSInteger)section{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 20)];
    view.backgroundColor = [UIColor clearColor];
    return view;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    UIViewController *viewController;
    switch (indexPath.row) {
        case 0:{
            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"缓存清理成功" delegate:nil cancelButtonTitle:@"好的" otherButtonTitles:nil, nil];
            [alertView show];
            break;

        
        }
            
        case 1:
            viewController = [[BKFeedBackViewController alloc] initWithNibName:NSStringFromClass([BKFeedBackViewController class]) bundle:nil];
            
            break;
        case 2:{
        
            UIAlertView *alterView = [[UIAlertView alloc] initWithTitle:@"关于我们"
        message:@"广州宏途教育网络科技有限公司\n广州天河区建工路8号" delegate:nil cancelButtonTitle:@"好的" otherButtonTitles:nil, nil];
            [alterView show];
            break;
        }
        case 3:
             [[PgyManager sharedPgyManager] checkUpdate];
            break;
        default:
            break;
    }
    
    if (viewController != nil) {
        [self presentViewController:viewController animated:YES completion:nil];
    }
}

@end
